<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="theme-color" content="black"><meta name="author" content="李子康"><meta name="copyright" content="李子康"><meta name="generator" content="Hexo 4.2.1"><meta name="theme" content="hexo-theme-yun"><title>信息安全实验一、加密与解密 | Lizikang_Blog</title><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@900&amp;display=swap" media="none" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/star-markdown-css@0.1.11/dist/yun/yun-markdown.min.css"><script src="//at.alicdn.com/t/font_1140697_stqaphw3j4.js" async></script><script src="https://cdn.jsdelivr.net/npm/scrollreveal/dist/scrollreveal.min.js" defer></script><script>document.addEventListener("DOMContentLoaded", () => {
  [".post-card",".post-content img"].forEach((target)=> {
    ScrollReveal().reveal(target);
  })
});
</script><script src="https://cdn.jsdelivr.net/npm/pjax@latest/pjax.min.js" defer></script><script src="/js/pjax.js" defer></script><link rel="shortcut icon" type="image/svg+xml" href="/images/%E7%9A%AE%E5%8D%A1%E4%B8%98-2.ico"><link rel="mask-icon" href="/images/%E7%9A%AE%E5%8D%A1%E4%B8%98-2.ico" color="black"><link rel="alternate icon" href="/yun.ico"><link rel="preload" href="/css/hexo-theme-yun.css" as="style"><link rel="preload" href="/js/utils.js" as="script"><link rel="preload" href="/js/hexo-theme-yun.js" as="script"><link rel="prefetch" href="/js/sidebar.js" as="script"><link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin><link rel="stylesheet" href="/css/hexo-theme-yun.css"><link rel="alternate" href="/atom.xml" title="Lizikang_Blog"><script id="yun-config">
    const Yun = window.Yun || {};
    window.CONFIG = {"root":"/","title":["Li","Zi","Kang","Blog"],"version":"0.9.2","anonymous_image":"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/avatar/none.jpg","say":{"api":"https://v1.hitokoto.cn","hitokoto":true},"fireworks":{"colors":["102, 167, 221","62, 131, 225","33, 78, 194"]}};
  </script><script src="//at.alicdn.com/t/font_1929835_1z6thct9lfe.js" async></script><meta name="description" content="实验一  加密与解密一、实验目的1.提高对加密与解密原理的认识 2.提高对信息隐藏原理的认识 3.学会使用加密与隐藏软件 4.了解口令破解基本方法； 5.体会设置安全口令的重要意义 二、实验要求使用任意高级语言做出给文本文件加、解密的软件.   三、实验重点、难点1.Easy code boy plus的使用 2.能熟练运用Lophtcrack、Aoxppr、Apdfprp、Mailhack等 四">
<meta property="og:type" content="article">
<meta property="og:title" content="信息安全实验一、加密与解密">
<meta property="og:url" content="http://yoursite.com/2021/05/15/%E4%BF%A1%E6%81%AF%E5%AE%89%E5%85%A8/%E4%BF%A1%E6%81%AF%E5%AE%89%E5%85%A8%E5%AE%9E%E9%AA%8C%E4%B8%80/index.html">
<meta property="og:site_name" content="Lizikang_Blog">
<meta property="og:description" content="实验一  加密与解密一、实验目的1.提高对加密与解密原理的认识 2.提高对信息隐藏原理的认识 3.学会使用加密与隐藏软件 4.了解口令破解基本方法； 5.体会设置安全口令的重要意义 二、实验要求使用任意高级语言做出给文本文件加、解密的软件.   三、实验重点、难点1.Easy code boy plus的使用 2.能熟练运用Lophtcrack、Aoxppr、Apdfprp、Mailhack等 四">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps1.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps2.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps3.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps4.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps5.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps6.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps7.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps8.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps9.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps10.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps11.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps12.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps13.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps14.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps15.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps16.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps17.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps18.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps19.jpg">
<meta property="og:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps22.jpg">
<meta property="article:published_time" content="2021-05-14T16:00:00.000Z">
<meta property="article:modified_time" content="2021-06-03T09:15:19.327Z">
<meta property="article:author" content="李子康">
<meta property="article:tag" content="信息安全">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps1.jpg"><script src="/js/ui/mode.js"></script><link rel="alternate" href="/atom.xml" title="Lizikang_Blog" type="application/atom+xml">
</head><body><script defer src="https://cdn.jsdelivr.net/npm/animejs@latest/anime.min.js"></script><script defer src="/js/ui/fireworks.js"></script><canvas class="fireworks"></canvas><div class="container"><a class="sidebar-toggle hty-icon-button" id="menu-btn"><div class="hamburger hamburger--spin" type="button"><span class="hamburger-box"><span class="hamburger-inner"></span></span></div></a><div class="sidebar-toggle sidebar-overlay"></div><aside class="sidebar"><script defer src="/js/sidebar.js"></script><ul class="sidebar-nav"><li class="sidebar-nav-item sidebar-nav-toc hty-icon-button sidebar-nav-active" data-target="post-toc-wrap" title="文章目录"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-list-ordered"></use></svg></li><li class="sidebar-nav-item sidebar-nav-overview hty-icon-button" data-target="site-overview-wrap" title="站点概览"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-passport-line"></use></svg></li></ul><div class="sidebar-panel" id="site-overview-wrap"><div class="site-info fix-top"><a class="site-author-avatar" href="/about/" title="李子康"><img width="96" loading="lazy" src="/images/bak.jpg" alt="李子康"></a><div class="site-author-name"><a href="/about/">李子康</a></div><a class="site-name" href="/about/site.html">Lizikang_Blog</a><sub class="site-subtitle"></sub><div class="site-desciption">个人技术博客</div></div><nav class="site-state"><a class="site-state-item hty-icon-button icon-home" href="/" title="我的主页"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-home-4-line"></use></svg></span></a><div class="site-state-item"><a href="/archives/" title="归档"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-archive-line"></use></svg></span><span class="site-state-item-count">27</span></a></div><div class="site-state-item"><a href="/categories/" title="分类"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-folder-2-line"></use></svg></span><span class="site-state-item-count">13</span></a></div><div class="site-state-item"><a href="/tags/" title="标签"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-price-tag-3-line"></use></svg></span><span class="site-state-item-count">9</span></a></div><a class="site-state-item hty-icon-button" href="https://yun.yunyoujun.cn" target="_blank" rel="noopener" title="文档"><span class="site-state-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-settings-line"></use></svg></span></a></nav><hr style="margin-bottom:0.5rem"><div class="links-of-author"><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://wpa.qq.com/msgrd?v=3&amp;uin=1191787635&amp;site=qq&amp;menu=yes" title="QQ" target="_blank" style="color:#12B7F5"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-qq-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://github.com/lizikanglzk" title="GitHub" target="_blank" style="color:#181717"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-github-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="mailto:1191787635@qq.com" title="E-Mail" target="_blank" style="color:#8E71C1"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-mail-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://gitee.com/li_zikang" title="gitee" target="_blank" style="color:#E6162D"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-gitee-copy"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://music.163.com/#/user/home?id=506556053" title="网易云音乐" target="_blank" style="color:#C10D0C"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-netease-cloud-music-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://blog.csdn.net/qq_43845915" title="csdn" target="_blank" style="color:#007722"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-csdn11"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://www.zhihu.com/people/zou-guo-lu-guo-bu-yao-cuo-guo-88" title="知乎" target="_blank" style="color:#0084FF"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-zhihu-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://space.bilibili.com/352594163" title="哔哩哔哩动画" target="_blank" style="color:#FF8EB3"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-bilibili-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" title="微信" target="_blank" style="color:#1AAD19"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-wechat-2-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="/atom.xml" title="RSS" target="_blank" style="color:orange"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-rss-line"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="/game1" title="Telegram Channel" target="_blank" style="color:#0088CC"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-youxi-copy-copy"></use></svg></a><a class="links-of-author-item hty-icon-button" rel="noopener" href="https://travellings.now.sh/" title="Travelling" target="_blank" style="color:var(--hty-text-color)"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-send-plane-2-line"></use></svg></a></div><hr style="margin:0.5rem 1rem"><div class="links"><a class="links-item hty-icon-button" href="/links/" title="我的小伙伴们" style="color:dodgerblue"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-men-line"></use></svg></a><a class="links-item hty-icon-button" href="/girls/" title="我的老婆们" style="color:#FF8EB3"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-women-line"></use></svg></a></div><br><a class="links-item hty-icon-button" id="toggle-mode-btn" href="javascript:;" title="Mode" style="color: #f1cb64"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-contrast-2-line"></use></svg></a></div><div class="sidebar-panel sidebar-panel-active" id="post-toc-wrap"><div class="post-toc"><div class="post-toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#实验一-加密与解密"><span class="toc-text">实验一  加密与解密</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#一、实验目的"><span class="toc-text">一、实验目的</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#二、实验要求"><span class="toc-text">二、实验要求</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#三、实验重点、难点"><span class="toc-text">三、实验重点、难点</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#四、实验学时"><span class="toc-text">四、实验学时</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#五、实验内容"><span class="toc-text">五、实验内容</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#六、注意事项"><span class="toc-text">六、注意事项</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#七、实验步骤"><span class="toc-text">七、实验步骤:</span></a></li></ol></li></ol></div></div></div></aside><main class="sidebar-translate" id="content"><div id="post"><article class="post-block" itemscope itemtype="https://schema.org/Article"><link itemprop="mainEntityOfPage" href="http://yoursite.com/2021/05/15/%E4%BF%A1%E6%81%AF%E5%AE%89%E5%85%A8/%E4%BF%A1%E6%81%AF%E5%AE%89%E5%85%A8%E5%AE%9E%E9%AA%8C%E4%B8%80/"><span hidden itemprop="author" itemscope itemtype="https://schema.org/Person"><meta itemprop="name" content="李子康"><meta itemprop="description"></span><span hidden itemprop="publisher" itemscope itemtype="https://schema.org/Organization"><meta itemprop="name" content="Lizikang_Blog"></span><header class="post-header"><h1 class="post-title" itemprop="name headline">信息安全实验一、加密与解密</h1><div class="post-meta"><div class="post-time" style="display:inline-block"><span class="post-meta-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-calendar-line"></use></svg></span> <time title="创建时间：2021-05-15 00:00:00" itemprop="dateCreated datePublished" datetime="2021-05-15T00:00:00+08:00">2021-05-15</time><span class="post-meta-divider">-</span><span class="post-meta-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-calendar-2-line"></use></svg></span> <time title="修改时间：2021-06-03 17:15:19" itemprop="dateModified" datetime="2021-06-03T17:15:19+08:00">2021-06-03</time></div><span class="post-busuanzi"><span class="post-meta-divider">-</span><span class="post-meta-item-icon" title="阅读次数"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-eye-line"></use></svg> <span id="busuanzi_value_page_pv"></span></span></span><div class="post-classify"><span class="post-category"><span class="post-meta-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-folder-line"></use></svg></span> <span itemprop="about" itemscope itemtype="https://schema.org/Thing"><a class="category" href="/categories/%E4%BF%A1%E6%81%AF%E5%AE%89%E5%85%A8/" style="--text-color:var(--hty-text-color)" itemprop="url" rel="index"><span itemprop="text">信息安全</span></a></span> > <span itemprop="about" itemscope itemtype="https://schema.org/Thing"><a class="category" href="/categories/%E4%BF%A1%E6%81%AF%E5%AE%89%E5%85%A8/%E5%AE%9E%E9%AA%8C/" style="--text-color:var(--hty-text-color)" itemprop="url" rel="index"><span itemprop="text">实验</span></a></span></span><span class="post-tag"><span class="post-meta-divider">-</span><a class="tag" href="/tags/%E4%BF%A1%E6%81%AF%E5%AE%89%E5%85%A8/" style="--text-color:var(--hty-text-color)"><span class="post-meta-item-icon"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-price-tag-3-line"></use></svg></span><span class="tag-name">信息安全</span></a></span></div></div></header><section class="post-body" itemprop="articleBody"><div class="post-content markdown-body" style="--smc-primary:black;"><h2 id="实验一-加密与解密"><a href="#实验一-加密与解密" class="headerlink" title="实验一  加密与解密"></a>实验一  加密与解密</h2><h3 id="一、实验目的"><a href="#一、实验目的" class="headerlink" title="一、实验目的"></a>一、实验目的</h3><p>1.提高对加密与解密原理的认识</p>
<p>2.提高对信息隐藏原理的认识</p>
<p>3.学会使用加密与隐藏软件</p>
<p>4.了解口令破解基本方法；</p>
<p>5.体会设置安全口令的重要意义</p>
<h3 id="二、实验要求"><a href="#二、实验要求" class="headerlink" title="二、实验要求"></a>二、实验要求</h3><p>使用任意高级语言做出给文本文件加、解密的软件.  </p>
<h3 id="三、实验重点、难点"><a href="#三、实验重点、难点" class="headerlink" title="三、实验重点、难点"></a>三、实验重点、难点</h3><p>1.Easy code boy plus的使用</p>
<p>2.能熟练运用Lophtcrack、Aoxppr、Apdfprp、Mailhack等</p>
<h3 id="四、实验学时"><a href="#四、实验学时" class="headerlink" title="四、实验学时"></a>四、实验学时</h3><p>2学时</p>
<h3 id="五、实验内容"><a href="#五、实验内容" class="headerlink" title="五、实验内容"></a>五、实验内容</h3><p>1、凯撒密码实现、维吉尼亚表加密、DES  </p>
<p>2、加密与隐藏软件的使用</p>
<p>3、利用破解密码软件破解口令</p>
<h3 id="六、注意事项"><a href="#六、注意事项" class="headerlink" title="六、注意事项"></a>六、注意事项</h3><p>Easy code boy plus可以将不同类型的文件作为寄主文件，将各种文件隐藏到不同类型的文件中。为了减少实验时间，实验破解用的密码可以选得简单一些。如1234。</p>
<h3 id="七、实验步骤"><a href="#七、实验步骤" class="headerlink" title="七、实验步骤:"></a>七、实验步骤:</h3><p><strong>任务一、参考教科书有关内容，掌握凯撒加密方法，自行设计密钥.编制程序。</strong>  </p>
<p>密码术可以大致别分为两种：即换位和替代，当然也有两者结合的更复杂的方法。在换位中字母不变，位置改变；替代中字母改变，位置不变。  </p>
<p>将替代密码用于军事用途的第一个文件记载是恺撒著的《高卢记》。恺撒描述了他如何将密信送到正处在被围困、濒临投降的西塞罗。其中罗马字母被替换成希腊字母使得敌人根本无法看懂信息。苏托尼厄斯在公元二世纪写的《恺撒传》中对恺撒用过的其中一种替代密码作了详细的描写。恺撒只是简单地把信息中的每一个字母用字母表中的该字母后的第三个字母代替。这种密码替换通常叫做凯撒移位密码，或简单的说，凯撒密码。  凯撒密码是将每一个字母向前推移K位。如K=3，则它的每一个明文字符都由其右边第三个（模26）字符代换如将字母A换作字母D，将字母B换作字母E。  </p>
<p>如有这样一条指令： RETURN TO ROME  </p>
<p>用恺撒密码加密后就成为： UHWXUA WR URPH  </p>
<p>如果这份指令被敌方截获，也将不会泄密，因为字面上看不出任何意义。  </p>
<p>这种加密方法还可以依据移位的不同产生新的变化，如将每个字母左19位，就产生这样一个明密对照表：  </p>
<p>明:A B C D E F G H I J K L M N O P Q R S T U V W X Y Z  </p>
<p>密:T U V W X Y Z A B C D E F G H I J K L M N O P Q R S  </p>
<p>暴力破解：  使用从1-25的密钥依次解密密文，看看得出来的结果是怎样的。 </p>
<p>参考资料：  尽管苏托尼厄斯仅提到三个位置的恺撒移位，但显然从1到25个位置的移位我们都可以使用， 因此，为了使密码有更高的安全性，单字母替换密码就出现了。  </p>
<p>如：  明码表 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z </p>
<p>密码表 Q W E R T Y U I O P A S D F G H J K L Z X C V B N M </p>
<p>明文 F O R E S T 密文 Y G K T L Z </p>
<p>只需重排密码表二十六个字母的顺序，允许密码表是明码表的任意一种重排，密钥就会增加到四千亿亿亿多种，我们就有超过4×1027种密码表。破解就变得很困难。 如何破解包括恺撒密码在内的单字母替换密码？  </p>
<p>方法：字母频度分析 </p>
<p>尽管我们不知道是谁发现了字母频度的差异可以用于破解密码。但是9世纪的科学家阿尔·金迪在《关于破译加密信息的手稿》对该技术做了最早的描述。“如果我们知道一条加密信息所使用的语言，那么破译这条加密信息的方法就是找出同样的语言写的一篇其他文章，大约一页纸长，然后我们计算其中每个字母的出现频率。我们将频率最高的字母标为1号，频率排第2的标为2号，第三标为3号，依次类推，直到数完样品文章中所有字母。然后我们观察需要破译的密文，同样分类出所有的字母，找出频率最高的字母，并全部用样本文章中最高频率的字母替换。第二高频的字母用样本中2号代替，第三则用3号替换，直到密文中所有字母均已被样本中的字母替换。” 以英文为例，首先我们以一篇或几篇一定长度的普通文章，建立字母表中每个字母的频度表。</p>
<p>在分析密文中的字母频率，将其对照即可破解。虽然设密者后来针对频率分析技术对以前的设密方法做了些改进，比如说引进空符号等，目的是为了打破正常的字母出现频率。但是小的改进已经无法掩盖单字母替换法的巨大缺陷了。到16世纪，最好的密码破译师已经能够破译当时大多数的加密信息。局限性： 短文可能严重偏离标准频率，加入文章少于100个字母，那么对它的解密就会比较困难。</p>
<p>1、开发工具：</p>
<p>DEV</p>
<p>2、代码编制：</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br></pre></td><td class="code"><pre><code class="hljs cpp">凯撒：<br><br>\<span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;stdio.h&gt;</span></span><br><br><span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span><br><span class="hljs-function"></span><br><span class="hljs-function"></span>&#123;<br><br> <span class="hljs-keyword">char</span> P[<span class="hljs-number">100</span>];<span class="hljs-comment">/*定义明文长度*/</span><br><br> <span class="hljs-keyword">char</span> C[<span class="hljs-number">100</span>];<span class="hljs-comment">/*定义密文长度*/</span><br><br> <span class="hljs-keyword">int</span> K=<span class="hljs-number">3</span>,i;<br><br> <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Please input Plaintext:\n"</span>); <span class="hljs-comment">/*输入明文*/</span><br><br> gets(P); <span class="hljs-comment">/* 接受明文*/</span><br><br> <br><br> <span class="hljs-keyword">for</span>(i=<span class="hljs-number">0</span>;P[i]!=<span class="hljs-string">'\0'</span>;i++) &#123;  <span class="hljs-comment">/*逐个判断字母的大小*/</span><br><br> <span class="hljs-keyword">if</span>(P[i]&gt;=<span class="hljs-string">'a'</span>&amp;&amp;P[i]&lt;=<span class="hljs-string">'z'</span>) <span class="hljs-comment">/*小写字母 */</span><br><br> C[i]=(P[i]-<span class="hljs-string">'a'</span>+K)%<span class="hljs-number">26</span>+<span class="hljs-string">'a'</span>;<br><br> <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span>(P[i]&gt;=<span class="hljs-string">'A'</span>&amp;&amp;P[i]&lt;=<span class="hljs-string">'Z'</span>)<span class="hljs-comment">/*大写字母 */</span><br><br> C[i]=(P[i]-<span class="hljs-string">'A'</span>+K)%<span class="hljs-number">26</span>+<span class="hljs-string">'A'</span>;<br><br> <span class="hljs-keyword">else</span> C[i]=<span class="hljs-string">' '</span>;<span class="hljs-comment">/*如果不是字母，转换为空格*/</span><br><br> &#125;<br><br> <br><br> <span class="hljs-built_in">printf</span>(<span class="hljs-string">"The Ciphertext is :\n%s\n"</span>,C);<span class="hljs-comment">/*输出密文*/</span><br><br><span class="hljs-comment">// getch();</span><br><br> <span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;<br><br>&#125;<br></code></pre></td></tr></table></figure>

<p>1、程序结构化，用函数分别实现</p>
<p>2、对文件的加密，解密输出到文件</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br></pre></td><td class="code"><pre><code class="hljs cpp"><span class="hljs-meta">#<span class="hljs-meta-keyword">include</span><span class="hljs-meta-string">&lt;stdio.h&gt;</span></span><br><br><span class="hljs-meta">#<span class="hljs-meta-keyword">include</span><span class="hljs-meta-string">&lt;conio.h&gt;</span></span><br><br> <br><br><span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">menu</span><span class="hljs-params">()</span><span class="hljs-comment">/*菜单，1.加密 2.解密 3.退出*/</span></span><br><span class="hljs-function"></span><br><span class="hljs-function"></span>&#123;<br><br><span class="hljs-comment">//clrscr();</span><br><br><span class="hljs-built_in">printf</span>(<span class="hljs-string">"\n==============================================================================="</span>);<br><br><span class="hljs-built_in">printf</span>(<span class="hljs-string">"\n1.Encrypt the file"</span>);<br><br><span class="hljs-built_in">printf</span>(<span class="hljs-string">"\n2.Decrypt the file"</span>);<br><br><span class="hljs-built_in">printf</span>(<span class="hljs-string">"\n3.Quit\n"</span>);<br><br><span class="hljs-built_in">printf</span>(<span class="hljs-string">"===============================================================================\n"</span>);<br><br><span class="hljs-built_in">printf</span>(<span class="hljs-string">"Please select a item:"</span>);<br><br><span class="hljs-keyword">return</span>;<br><br>&#125;<br><br> <br><br><span class="hljs-function"><span class="hljs-keyword">char</span> <span class="hljs-title">encrypt</span><span class="hljs-params">(<span class="hljs-keyword">char</span> ch,<span class="hljs-keyword">int</span> n)</span><span class="hljs-comment">/*加密函数，把字符向右循环移位n*/</span></span><br><span class="hljs-function"></span><br><span class="hljs-function"></span>&#123;<br><br><span class="hljs-keyword">while</span>(ch&gt;=<span class="hljs-string">'A'</span>&amp;&amp;ch&lt;=<span class="hljs-string">'Z'</span>)<br><br>&#123;<br><br><span class="hljs-keyword">return</span> (<span class="hljs-string">'A'</span>+(ch-<span class="hljs-string">'A'</span>+n)%<span class="hljs-number">26</span>);<br><br>&#125;<br><br><span class="hljs-keyword">while</span>(ch&gt;=<span class="hljs-string">'a'</span>&amp;&amp;ch&lt;=<span class="hljs-string">'z'</span>)<br><br>&#123;<br><br><span class="hljs-keyword">return</span> (<span class="hljs-string">'a'</span>+(ch-<span class="hljs-string">'a'</span>+n)%<span class="hljs-number">26</span>);<br><br>&#125;<br><br><span class="hljs-keyword">return</span> ch;<br><br>&#125;<br><br> <br><br> <br><br>main()<br><br>&#123;<br><br><span class="hljs-keyword">int</span> i,n;<br><br><span class="hljs-keyword">char</span> ch0,ch1;<br><br>FILE *in,*out;<br><br><span class="hljs-keyword">char</span> infile[<span class="hljs-number">10</span>],outfile[<span class="hljs-number">10</span>];<br><br> <br><br><span class="hljs-comment">//textbackground(RED);</span><br><br><span class="hljs-comment">//textcolor(LIGHTGREEN);</span><br><br><span class="hljs-comment">//clrscr();</span><br><br> <br><br>menu();<br><br>ch0=getch();<br><br> <br><br><span class="hljs-keyword">while</span>(ch0!=<span class="hljs-string">'3'</span>)<br><br>&#123;<br><br><span class="hljs-keyword">if</span>(ch0==<span class="hljs-string">'1'</span>)<br><br>&#123;<br><br><span class="hljs-comment">//  clrscr();</span><br><br>  <span class="hljs-built_in">printf</span>(<span class="hljs-string">"\nPlease input the infile:"</span>);<br><br>  <span class="hljs-built_in">scanf</span>(<span class="hljs-string">"%s"</span>,infile);<span class="hljs-comment">/*输入需要加密的文件名*/</span><br><br> <br><br>  <span class="hljs-keyword">if</span>((in=fopen(infile,<span class="hljs-string">"r"</span>))==<span class="hljs-literal">NULL</span>)<br><br>  &#123;<br><br>  <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Can not open the infile!\n"</span>);<br><br>  <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Press any key to exit!\n"</span>);<br><br>  getch();<br><br><span class="hljs-comment">//   exit(0);</span><br><br>  &#125;<br><br> <br><br>  <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Please input the key:"</span>);<br><br>  <span class="hljs-built_in">scanf</span>(<span class="hljs-string">"%d"</span>,&amp;n);<span class="hljs-comment">/*输入加密密码*/</span><br><br> <br><br>  <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Please input the outfile:"</span>);<br><br>  <span class="hljs-built_in">scanf</span>(<span class="hljs-string">"%s"</span>,outfile);<span class="hljs-comment">/*输入加密后文件的文件名*/</span><br><br> <br><br>  <span class="hljs-keyword">if</span>((out=fopen(outfile,<span class="hljs-string">"w"</span>))==<span class="hljs-literal">NULL</span>)<br><br>  &#123;<br><br>  <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Can not open the outfile!\n"</span>);<br><br>  <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Press any key to exit!\n"</span>);<br><br>  fclose(in);<br><br>  getch();<br><br><span class="hljs-comment">//   exit(0);</span><br><br>  &#125;<br><br> <br><br>  <span class="hljs-keyword">while</span>(!feof(in))<span class="hljs-comment">/*加密*/</span><br><br>  &#123;<br><br>  fputc(encrypt(fgetc(in),n),out);<br><br>  &#125;<br><br> <br><br>  <span class="hljs-built_in">printf</span>(<span class="hljs-string">"\nEncrypt is over!\n"</span>);<br><br>  fclose(in);<br><br>  fclose(out);<br><br><span class="hljs-comment">//  sleep(1);</span><br><br>&#125;<br><br> <br><br><span class="hljs-keyword">if</span>(ch0==<span class="hljs-string">'2'</span>)<br><br>&#123;<br><br><span class="hljs-comment">//  clrscr();</span><br><br>​           <span class="hljs-built_in">printf</span>(<span class="hljs-string">"\nPlease input the infile:"</span>);<br><br>  <span class="hljs-built_in">scanf</span>(<span class="hljs-string">"%s"</span>,infile);<span class="hljs-comment">/*输入需要解密的文件名*/</span><br><br> <br><br>​            <span class="hljs-keyword">if</span>((in=fopen(infile,<span class="hljs-string">"r"</span>))==<span class="hljs-literal">NULL</span>)<br><br>  &#123;<br><br>  <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Can not open the infile!\n"</span>);<br><br>  <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Press any key to exit!\n"</span>);<br><br>  getch();<br><br><span class="hljs-comment">//   exit(0);</span><br><br>  &#125;<br><br> <br><br>  <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Please input the key:"</span>);<br><br>  <span class="hljs-built_in">scanf</span>(<span class="hljs-string">"%d"</span>,&amp;n);<span class="hljs-comment">/*输入解密密码（可以为加密时候的密码）*/</span><br><br> <br><br>  n=<span class="hljs-number">26</span>-n;<br><br> <br><br>  <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Please input the outfile:"</span>);<br><br>  <span class="hljs-built_in">scanf</span>(<span class="hljs-string">"%s"</span>,outfile);<span class="hljs-comment">/*输入解密后文件的文件名*/</span><br><br> <br><br>  <span class="hljs-keyword">if</span>((out=fopen(outfile,<span class="hljs-string">"w"</span>))==<span class="hljs-literal">NULL</span>)<br><br>  &#123;<br><br>  <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Can not open the outfile!\n"</span>);<br><br>  <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Press any key to exit!\n"</span>);<br><br>  fclose(in);<br><br>  getch();<br><br><span class="hljs-comment">//   exit(0);</span><br><br>  &#125;<br><br> <br><br>  <span class="hljs-keyword">while</span>(!feof(in))<br><br>  &#123;<br><br>  fputc(encrypt(fgetc(in),n),out);<br><br>  &#125;<br><br>  <span class="hljs-built_in">printf</span>(<span class="hljs-string">"\nDecrypt is over!\n"</span>);<br><br>  fclose(in);<br><br>  fclose(out);<br><br><span class="hljs-comment">//  sleep(1);</span><br><br>&#125;<br><br> <br><br> <br><br><span class="hljs-comment">//clrscr();</span><br><br> <br><br><span class="hljs-comment">//     printf("\nGood Bye!\n");</span><br><br><span class="hljs-comment">//sleep(3);</span><br><br> <br><br> <br><br> <br><br>  getch();<br><br>&#125;<br><br>&#125;<br></code></pre></td></tr></table></figure>



<figure class="highlight mel"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br></pre></td><td class="code"><pre><code class="hljs mel"><span class="hljs-comment">/*移位法:*/</span><br><br>#include &lt;stdio.h&gt;<br><br>#include &lt;stdlib.h&gt;<br><br>char *Encrypt(char *<span class="hljs-keyword">pwd</span>,<span class="hljs-keyword">int</span> key) <span class="hljs-comment">/*加密*/</span><br><br>&#123;<br><br>	<span class="hljs-keyword">for</span>(<span class="hljs-keyword">int</span> i=<span class="hljs-number">0</span>;*(<span class="hljs-keyword">pwd</span>+i)!=<span class="hljs-string">'\0'</span>;i++)<br><br>	&#123;<br><br>		<span class="hljs-keyword">if</span>(*(<span class="hljs-keyword">pwd</span>+i)&gt;=<span class="hljs-string">'a'</span>&amp;&amp;*(<span class="hljs-keyword">pwd</span>+i)&lt;=<span class="hljs-string">'z'</span>)<br><br>			*(<span class="hljs-keyword">pwd</span>+i)=(*(<span class="hljs-keyword">pwd</span>+i)-<span class="hljs-string">'a'</span>+key)%26+<span class="hljs-string">'a'</span>;<br><br>		<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span>(*(<span class="hljs-keyword">pwd</span>+i)&gt;=<span class="hljs-string">'A'</span>&amp;&amp;*(<span class="hljs-keyword">pwd</span>+i)&lt;=<span class="hljs-string">'Z'</span>)<br><br>			*(<span class="hljs-keyword">pwd</span>+i)=(*(<span class="hljs-keyword">pwd</span>+i)-<span class="hljs-string">'A'</span>+key)%26+<span class="hljs-string">'A'</span>;<br><br>	&#125;<br><br>	<span class="hljs-keyword">return</span> <span class="hljs-keyword">pwd</span>;<br><br>&#125;<br><br> <br><br>char *Decrypt(char *<span class="hljs-keyword">pwd</span>,<span class="hljs-keyword">int</span> key) <span class="hljs-comment">/*解密*/</span><br><br>&#123;<br><br>	<span class="hljs-keyword">for</span>(<span class="hljs-keyword">int</span> i=<span class="hljs-number">0</span>;*(<span class="hljs-keyword">pwd</span>+i)!=<span class="hljs-string">'\0'</span>;i++)<br><br>	&#123;<br><br>		<span class="hljs-keyword">if</span>(*(<span class="hljs-keyword">pwd</span>+i)&gt;=<span class="hljs-string">'a'</span>&amp;&amp;*(<span class="hljs-keyword">pwd</span>+i)&lt;=<span class="hljs-string">'z'</span>)<br><br>		&#123;<br><br>			<span class="hljs-keyword">if</span>(*(<span class="hljs-keyword">pwd</span>+i)-<span class="hljs-string">'a'</span>&gt;=key%26)<br><br>				*(<span class="hljs-keyword">pwd</span>+i)=*(<span class="hljs-keyword">pwd</span>+i)-key%26;<br><br>			<span class="hljs-keyword">else</span> *(<span class="hljs-keyword">pwd</span>+i)=<span class="hljs-string">'z'</span>-(key%26-(*(<span class="hljs-keyword">pwd</span>+i)-<span class="hljs-string">'a'</span>))<span class="hljs-number">-1</span>;<br><br>		&#125;<br><br>		<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span>(*(<span class="hljs-keyword">pwd</span>+i)&gt;=<span class="hljs-string">'A'</span>&amp;&amp;*(<span class="hljs-keyword">pwd</span>+i)&lt;=<span class="hljs-string">'Z'</span>)<br><br>		&#123;<br><br>			<span class="hljs-keyword">if</span>(*(<span class="hljs-keyword">pwd</span>+i)-<span class="hljs-string">'A'</span>&gt;=key%26)<br><br>				*(<span class="hljs-keyword">pwd</span>+i)=*(<span class="hljs-keyword">pwd</span>+i)-key%26;<br><br>			<span class="hljs-keyword">else</span> *(<span class="hljs-keyword">pwd</span>+i)=<span class="hljs-string">'Z'</span>-(key%26-(*(<span class="hljs-keyword">pwd</span>+i)-<span class="hljs-string">'A'</span>))<span class="hljs-number">-1</span>;<br><br>		&#125;<br><br>	&#125;<br>	<span class="hljs-keyword">return</span> <span class="hljs-keyword">pwd</span>;<br><br>&#125;<br><br> <br><br><span class="hljs-keyword">int</span> main()<br><br>&#123;<br><br>	char *<span class="hljs-keyword">pwd</span>;<br><br>	<span class="hljs-keyword">int</span> key;<br><br>	<span class="hljs-keyword">pwd</span>=(char*)malloc(sizeof(char));<br><br>	printf(<span class="hljs-string">"Input your password:"</span>);<br><br>	gets(<span class="hljs-keyword">pwd</span>);<br><br>	printf(<span class="hljs-string">"Input a key:"</span>);<br><br>	scanf(<span class="hljs-string">"%d"</span>,&amp;key);<br><br> <br><br>	printf(<span class="hljs-string">"The Ciphertext is:"</span>);<br><br>	printf(<span class="hljs-string">"%s\n"</span>,Encrypt(<span class="hljs-keyword">pwd</span>,key));<br><br>&#125;<br></code></pre></td></tr></table></figure>

<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br></pre></td><td class="code"><pre><code class="hljs cpp"><span class="hljs-comment">/*替换法：*/</span><br><br> <br><br><span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;stdio.h&gt;</span></span><br><br><span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;stdlib.h&gt;</span></span><br><br><span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;string.h&gt;</span></span><br><br><span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">table</span><span class="hljs-params">(<span class="hljs-keyword">char</span> *keyword)</span> <span class="hljs-comment">/*筛选密钥(去重复去空格)*/</span></span><br><span class="hljs-function"></span><br><span class="hljs-function"></span>&#123;<br><br>​	<span class="hljs-keyword">int</span> i,j,k;<br><br>​	<span class="hljs-keyword">for</span>(i=<span class="hljs-number">0</span>;*(keyword+i)!=<span class="hljs-string">'\0'</span>;i++)<br><br>​	&#123;<br><br>​		<span class="hljs-keyword">for</span>(j=i;*(keyword+j)!=<span class="hljs-string">'\0'</span>;j++)<br><br>​		&#123;<br><br>​			<span class="hljs-keyword">if</span>(i!=j)<br><br>​				<span class="hljs-keyword">if</span>(*(keyword+i)==*(keyword+j)||*(keyword+j)==<span class="hljs-string">' '</span>)<br><br>​				&#123;<br><br>​					<span class="hljs-keyword">for</span>(k=j;*(keyword+k)!=<span class="hljs-string">'\0'</span>;k++)<br><br>​					*(keyword+k)=*(keyword+k+<span class="hljs-number">1</span>);<br><br>​					j--;<br><br>​				&#125;<br><br>​		&#125;<br><br>​	&#125;<br><br>&#125;<br><br> <br><br><span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">newTab</span><span class="hljs-params">(<span class="hljs-keyword">char</span> *keyword)</span> <span class="hljs-comment">/*生成密钥表*/</span></span><br><span class="hljs-function"></span><br><span class="hljs-function"></span>&#123;<br><br>​	<span class="hljs-keyword">char</span> ch;<br><br>​	<span class="hljs-keyword">int</span> i;<br><br>​	<span class="hljs-keyword">int</span> t;<br><br>​	<span class="hljs-keyword">for</span>(t=<span class="hljs-number">0</span>;*(keyword+t)!=<span class="hljs-string">'\0'</span>;t++);<br><br> <br><br>​	<span class="hljs-keyword">for</span>(ch=<span class="hljs-string">'a'</span>;ch&lt;=<span class="hljs-string">'z'</span>;ch++)<br><br>​	&#123;<br><br>​		<span class="hljs-keyword">for</span>(i=<span class="hljs-number">0</span>;*(keyword+i)!=ch;i++)<br><br>​		&#123;<br><br>​			<span class="hljs-keyword">if</span>(*(keyword+i)==<span class="hljs-string">'\0'</span>)<br><br>​			&#123;<br><br>​				*(keyword+t)=ch;<br><br>​				t++;<br><br>​				<span class="hljs-keyword">break</span>;<br><br>​			&#125;<br><br>​		&#125;<br><br>​	&#125;<br><br>​	*(keyword+t)=<span class="hljs-string">'\0'</span>;<br><br>&#125;<br><br> <br><br> <br><br><span class="hljs-function"><span class="hljs-keyword">char</span> *<span class="hljs-title">Ciphertext</span><span class="hljs-params">(<span class="hljs-keyword">char</span> *keyword,<span class="hljs-keyword">char</span> *Plaintext)</span> <span class="hljs-comment">/*按密码表加密*/</span></span><br><span class="hljs-function"></span><br><span class="hljs-function"></span>&#123;<br><br>​	<span class="hljs-keyword">char</span> ch;<br><br>​	<span class="hljs-keyword">int</span> i,j;<br><br>​	<span class="hljs-keyword">for</span>(i=<span class="hljs-number">0</span>;*(Plaintext+i)!=<span class="hljs-string">'\0'</span>;i++)<br><br>​	&#123;<br><br>​		<span class="hljs-keyword">for</span>(ch=<span class="hljs-string">'a'</span>,j=<span class="hljs-number">0</span>;ch&lt;=<span class="hljs-string">'z'</span>;ch++,j++)<br><br>​		&#123;<br><br>​			<span class="hljs-keyword">if</span>(*(Plaintext+i)==ch)<br><br>​			&#123;<br><br>​				*(Plaintext+i)=*(keyword+j);<br><br>​				<span class="hljs-keyword">break</span>;<br><br>​			&#125;<br><br>​		&#125;<br><br>​	&#125;<br><br>​	<span class="hljs-keyword">return</span> Plaintext;<br><br>&#125;<br><br> <br><br><span class="hljs-function"><span class="hljs-keyword">char</span> *<span class="hljs-title">Decrypt</span><span class="hljs-params">(<span class="hljs-keyword">char</span> *keyword,<span class="hljs-keyword">char</span> *Plaintext)</span> <span class="hljs-comment">/*解密*/</span></span><br><span class="hljs-function"></span><br><span class="hljs-function"></span>&#123;<br><br>​	<span class="hljs-keyword">char</span> ch;<br><br>​	<span class="hljs-keyword">int</span> i,j;<br><br>​	<span class="hljs-keyword">for</span>(i=<span class="hljs-number">0</span>;*(Plaintext+i)!=<span class="hljs-string">'\0'</span>;i++)<br><br>​	&#123;<br><br>​		<span class="hljs-keyword">for</span>(ch=<span class="hljs-string">'a'</span>,j=<span class="hljs-number">0</span>;*(keyword+j)!=<span class="hljs-string">'\0'</span>;ch++,j++)<br><br>​		&#123;<br><br>​			<span class="hljs-keyword">if</span>(*(Plaintext+i)==*(keyword+j))<br><br>​			&#123;<br><br>​				*(Plaintext+i)=ch;<br><br>​				<span class="hljs-keyword">break</span>;<br><br>​			&#125;<br><br>​		&#125;<br><br>​	&#125;<br><br>​	<span class="hljs-keyword">return</span> Plaintext;<br><br>&#125;<br><br> <br><br><span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span><br><span class="hljs-function"></span><br><span class="hljs-function"></span>&#123;<br><br>​	<span class="hljs-keyword">char</span> *keyword,*Plaintext,*tmp=<span class="hljs-literal">NULL</span>;<br><br>​	keyword=(<span class="hljs-keyword">char</span>*)<span class="hljs-built_in">malloc</span>(<span class="hljs-keyword">sizeof</span>(<span class="hljs-keyword">char</span>));<br><br>​	Plaintext=(<span class="hljs-keyword">char</span>*)<span class="hljs-built_in">malloc</span>(<span class="hljs-keyword">sizeof</span>(<span class="hljs-keyword">char</span>));<br><br> <br><br>​	<span class="hljs-built_in">printf</span>(<span class="hljs-string">"Input key word:"</span>);  <span class="hljs-comment">/*输入欲用密钥*/</span><br><br>​	gets(keyword);<br><br>​	<span class="hljs-built_in">printf</span>(<span class="hljs-string">"Input Plaintext:"</span>); <span class="hljs-comment">/*输入要转换的明文*/</span><br><br>​	gets(Plaintext);<br><br> <br><br>​	table(keyword);  <span class="hljs-comment">/*去空格去重复*/</span><br><br>​	newTab(keyword); <span class="hljs-comment">/*生成密码表*/</span><br><br> <br><br>​	tmp=Ciphertext(keyword,Plaintext); <span class="hljs-comment">/*对应着密码表生成密文*/</span><br><br>​	<span class="hljs-built_in">puts</span>(tmp); <span class="hljs-comment">/*输出密文*/</span><br><br>​	<span class="hljs-built_in">puts</span>(Decrypt(keyword,tmp)); <span class="hljs-comment">/*解密输出*/</span><br><br>&#125;<br></code></pre></td></tr></table></figure>



























<p>3、运行效果：</p>
<p>凯撒密码 </p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps1.jpg" alt="img" loading="lazy"> </p>
<p>1、程序结构化，用函数分别实现</p>
<p>2、对文件的加密，解密输出到文件</p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps2.jpg" alt="img" loading="lazy"> </p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps3.jpg" alt="img" loading="lazy"> </p>
<p>/<em>移位法:</em>/</p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps4.jpg" alt="img" loading="lazy"> </p>
<p>/<em>替换法：</em>/</p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps5.jpg" alt="img" loading="lazy"> </p>
<p><strong>任务二、加密与隐藏软件的使用</strong></p>
<p>\1. 加密文件</p>
<p>2.解密文件</p>
<p>3.生成随机密码</p>
<p>4.生成可自解密文件</p>
<p>5.文件隐藏与恢复</p>
<p>6.伪装文件夹</p>
<p>1.加密文件</p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps6.jpg" alt="img" loading="lazy"> </p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps7.jpg" alt="img" loading="lazy"> </p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps8.jpg" alt="img" loading="lazy"> </p>
<p>2.解密文件</p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps9.jpg" alt="img" loading="lazy"> </p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps10.jpg" alt="img" loading="lazy"> </p>
<p>3.生成随机密码</p>
<p><a href="https://suijimimashengcheng.bmcx.com/" target="_blank" rel="noopener">https://suijimimashengcheng.bmcx.com/</a></p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps11.jpg" alt="img" loading="lazy"> </p>
<p>4.生成可自解密文件</p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps12.jpg" alt="img" loading="lazy"> </p>
<p>5.文件隐藏与恢复</p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps13.jpg" alt="img" loading="lazy"> </p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps14.jpg" alt="img" loading="lazy"> </p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps15.jpg" alt="img" loading="lazy"> </p>
<p>6.伪装文件夹</p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps16.jpg" alt="img" loading="lazy"> </p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps17.jpg" alt="img" loading="lazy"> </p>
<p><strong>任务三、利用破解密码软件破解口令</strong></p>
<p>1.破解Windows7系统密码</p>
<p> 2.破解Office文档密码</p>
<p> 3.破解PDF文档密码</p>
<p>2.破解Office文档密码</p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps18.jpg" alt="img" loading="lazy"> </p>
<p>3.破解PDF文档密码</p>
<p><a href="http://app.xunjiepdf.com/pdfaddpwd/" target="_blank" rel="noopener">http://app.xunjiepdf.com/pdfaddpwd/</a></p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps19.jpg" alt="img" loading="lazy"> </p>
<p>解密成功</p>
<p><img src="https://gitee.com/li_zikang/lzk-image/raw/master/img/wps22.jpg" alt="img" loading="lazy"> </p>
<p>八、实验小结（100字左右）</p>
<p>在本次实验中了解熟悉了各种加密算法，对加密算法有了更加深刻的理解，后学习了加密工具，了解了加密工具的使用，学会了伪装文件、机密文件、机密pdf 体会到信息安全的重要性。在今后做项目中，要多加注意信息的加密，本次实验受益匪浅，期待下一次的实验，在课后我也会都加学习了解加密代码，感谢老师。</p>
</div></section></article><div class="post-nav"><div class="post-nav-item"><a class="post-nav-prev" href="/2021/05/18/%E4%BF%A1%E6%81%AF%E5%AE%89%E5%85%A8/%E4%BF%A1%E6%81%AF%E5%AE%89%E5%85%A8%E5%AE%9E%E9%AA%8C%E4%BA%8C/" rel="prev" title="信息安全实验二、漏洞扫描与病毒防治"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-arrow-left-s-line"></use></svg><span class="post-nav-text">信息安全实验二、漏洞扫描与病毒防治</span></a></div><div class="post-nav-item"><a class="post-nav-next" href="/2020/09/07/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C/%E8%AE%A1%E7%BD%91%E5%A4%8D%E4%B9%A0%E9%A2%98/" rel="next" title="计算机网络笔记 考试篇"><span class="post-nav-text">计算机网络笔记 考试篇</span><svg class="icon" aria-hidden="true"><use xlink:href="#icon-arrow-right-s-line"></use></svg></a></div></div></div><div id="comment"><div class="comment-tooltip text-center"></div><div id="valine-container"></div><script src="https://cdn.jsdelivr.net/npm/valine@latest/dist/Valine.min.js"></script><script>function initValine() {
  const valineConfig = {"enable":true,"appId":"q22e7srtjevOqYmzusWCYIru-gzGzoHsz","appKey":"PMyzTxHUFQ77nPj1IWMcMDK3","placeholder":"畅所欲言！","avatar":null,"meta":["nick","mail","link"],"pageSize":10,"visitor":false,"highlight":true,"recordIP":false,"enableQQ":true,"el":"#valine-container","lang":"zh-cn"}
  valineConfig.path = window.location.pathname
  new Valine(valineConfig)
}
setTimeout(initValine, 1000)</script></div></main><footer class="sidebar-translate" id="footer"><div class="copyright"><span>&copy; 2020 – 2022 </span><span class="with-love" id="animate"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-cloud-line"></use></svg></span><span class="author"> 李子康</span></div><div class="powered"><span>由 <a href="https://hexo.io" target="_blank" rel="noopener">Hexo</a> 驱动 v4.2.1</span><span class="footer-separator">|</span><span>主题 - <a rel="noopener" href="https://github.com/YunYouJun/hexo-theme-yun" target="_blank"><span>Yun</span></a> v0.9.2</span></div><div class="live_time"><span>本博客已萌萌哒地运行</span><span id="display_live_time"></span><span class="moe-text">(●'◡'●)</span><script>function blog_live_time() {
  window.setTimeout(blog_live_time, 1000);
  const start = new Date('2020-07-05T00:00:00');
  const now = new Date();
  const timeDiff = (now.getTime() - start.getTime());
  const msPerMinute = 60 * 1000;
  const msPerHour = 60 * msPerMinute;
  const msPerDay = 24 * msPerHour;
  const passDay = Math.floor(timeDiff / msPerDay);
  const passHour = Math.floor((timeDiff % msPerDay) / 60 / 60 / 1000);
  const passMinute = Math.floor((timeDiff % msPerHour) / 60 / 1000);
  const passSecond = Math.floor((timeDiff % msPerMinute) / 1000);
  display_live_time.innerHTML = " " + passDay + " 天 " + passHour + " 小时 " + passMinute + " 分 " + passSecond + " 秒";
}
blog_live_time();
</script></div><div id="busuanzi"><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><span id="busuanzi_container_site_uv" title="总访客量"><span><svg class="icon" aria-hidden="true"><use xlink:href="#icon-user-line"></use></svg></span><span id="busuanzi_value_site_uv"></span></span><span class="footer-separator">|</span><span id="busuanzi_container_site_pv" title="总访问量"><span><svg class="icon" aria-hidden="true"><use xlink:href="#icon-eye-line"></use></svg></span><span id="busuanzi_value_site_pv"></span></span></div></footer><a class="hty-icon-button" id="goUp" aria-label="back-to-top" href="#"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-arrow-up-s-line"></use></svg><svg class="progress-circle-container" viewBox="0 0 100 100"><circle class="progress-circle" id="progressCircle" cx="50" cy="50" r="48" fill="none" stroke="black" stroke-width="2" stroke-linecap="round"></circle></svg></a></div><script defer src="/js/utils.js"></script><script defer src="/js/hexo-theme-yun.js"></script><script defer src="/js/player.js"></script></body></html>